package datastructre;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class SetDemo01 {
    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        boolean r1 = set.add("zhangsan");
        boolean r2 = set.add("zhangsan");
        set.add("lisi");
        set.add("wangw");
//        System.out.println(set);
//        System.out.println(r1+" "+r2);

//        Iterator<String> it = set.iterator();
//        while(it.hasNext()) {
//            System.out.println(it.next());
//        }

        set.forEach(a-> System.out.println(a));


//        for (String s : set) {
//            System.out.println(s);
//        }

    }


}
